home *** CD-ROM | disk | FTP | other *** search
- 10/04/94
- PARSEDM2.ZIP - Revision 2 of demo project uploaded on
- CIS MSBASIC and VBPJ fora.
-
- The project - PARSEDM2.MAK - A revision of a labor day project assembled from
- some good codestuff which I have found useful.
-
- By Paul W. Reynolds, CIS 71011,2040
- Internet Paul.Reynolds@Channel1.Com
- (note - I check in on CIS much more frequently
- than I do on Channel1)
-
- Revisions made for second uploaded version:
-
- * Some minor changes made in the structure of the two
- standard parsing routines.
-
- * Added new routine utilizing the VB listbox instead of arrays -
- sometimes this is more convenient, and you don't have to deal
- with array resizing.
-
- * Improved interface with main menu and icons for forms.
-
- * Removed SPIN.VBX and replaced it with a vertical scroll bar.
-
-
- **** ITEM OF INTEREST 1 - The items in the listbox may be
- added in two ways - first, by the standard Vb AddItem method,
- and second, using the SendMessage API. I tried them both, and
- was surprised to find the AddItem method perform FASTER than the
- API technique. To test this for yourself, go into the
- ParseAndFillListBox% function, comment out the following
- line:
- L.AddItem Mid$(TheString$, CurPos%, CurStrLen%)
-
- and uncomment either one of the two following lines
- 'ret& = SendMessageByString&(L.hWnd, LB_INSERTSTRING, -1, Mid$(TheString$, CurPos%, CurStrLen%))
- 'ret& = SendMessageByString&(L.hWnd, LB_ADDSTRING, 0, Mid$(TheString$, CurPos%, CurStrLen%))
-
- Compare the timing results.
-
-
- Item of interest 2 - Routine GoNextForm() in SELECT.BAS contains a
- useful application of the parsing functions ParseAndFillArray1%() and
- ProcessArray$() to remove ampersands from labels.
-
- Information on Parse demo project.
-
- This project demonstrates routines can be used to effectively
- parse a string into its elements. In this demo they are used
- to obtain the word count and linecount in a textbox. A single or
- variable length delimiter may be used. For small amounts of text
- are plenty fast but they bog down with large amounts of text.
- The 32K limit is also a pain (actually under 28K with VB
- text boxes). Nonetheless for many situations they are
- useful (parsing command-line parameters, tag values, INI
- file processing, etc.). With two function calls, text can be
- processed to replace CRLF's with spaces, or spaces replaced
- with CRLF's at particular length intervals.
-
-
- No special VBX's or DLL's required except for the VB
- runtime library VBRUN300.DLL.
-
- To run the program, copy all the files into a common directory,
- and run the program from that directory.
-
-
- File List:
-
- MAIN.BAS - Startup module with Sub Main(), and a few global
- declarations and constants.
-
- PARSE.BAS - Contains routines used to parse and process strings
- and text. Explanations and information are given above each function
- routine, and code is heavily commented here and elsewhere
- (as is my convention).
-
- SELECT.BAS - Routine added in version 2 which processes user function
- selections and interaction between forms.
-
- MDELIM.FRM (frmMultiDelim) - The form which appears
- when the 'Multiple Char. Delim Test' command button is executed
- from frmMain. This part of the demonstration shows how the
- routines in PARSE.BAS can be used for parsing small strings
- and finding strings within strings.
-
- PARSE.FRM (frmParse) - The code required to execute the parsing of a text
- field into lines and words is called here.
-
- SELFILE.FRM (frmSelFile) - This form loads when the 'Select File'
- command button is executed from frmParse. This is where you select a text file
- to parse.
-
- PARSEME2.TXT - This readme file.
-
- BASIC.TXT - A short text file I used fro testing the code.
-
- PARSEDM2.MAK
-
-
-
-
- Other Comments:
- In the modules, note the use of:
- Option Explicit
- Option Compare Text (where useful)
-
- Naming conventions used:
-
- * Variables - Type-declaration characters used for giving variable
- type information. I also use prefixes for module and global
- scope (this project has no module or global variables).
-
- * Standard control prefixes are used similar to those recommended
- by MS Consulting Services.
-
-
- This project is Public Domain - I hope that it is useful, but
- I hold no responsibility for any damages resulting from the
- use and/or misuse of the code contained herein. If you find any
- errors in these routines or have any questions, please
- contact me by E_Mail.
-
-
-
-